Skip to content

gh-149083: Make functools.Placeholder a sentinel#149088

Open
JelleZijlstra wants to merge 1 commit intopython:mainfrom
JelleZijlstra:placehold
Open

gh-149083: Make functools.Placeholder a sentinel#149088
JelleZijlstra wants to merge 1 commit intopython:mainfrom
JelleZijlstra:placehold

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra commented Apr 28, 2026

This greatly simplifies the code. The only behavioral difference observable in the tests is that type(Placeholder)() no longer works, because Placeholder is now an instance of sentinel.


📚 Documentation preview 📚: https://cpython-previews--149088.org.readthedocs.build/

@picnixz
Copy link
Copy Markdown
Member

picnixz commented Apr 28, 2026

Is type(Placeholder)() acceptable? I would have actually expected that type(MySentinel)() returned the sentinel as for type(None)() but it's not the case since MySentinel is an instance of a sentinel!

@picnixz
Copy link
Copy Markdown
Member

picnixz commented Apr 28, 2026

Actually, since we're launching beta, it may be ok to change this and see if it breaks something

@JelleZijlstra
Copy link
Copy Markdown
Member Author

It's difficult to imagine why people would be doing things like type(Placeholder)() outside of test code, but you never know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants